package com.wangx1n.boobey.util;

import com.baidu.aip.speech.AipSpeech;
import com.google.gson.Gson;
import org.json.JSONObject;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author wangxin
 * @create 2020-06-12 20:44
 */
public class BaiduAi {
    private static final String AppID="20373769";
    private static final String API_Key="iO3KgOVy1SnjHQ1o38CtuEAI";
    private static final String Secret_Key="5hUYSuCLb8puxbGyW6rScSTOO6gAapWz";
    // 初始化一个AipSpeech
    private static AipSpeech client = new AipSpeech(AppID,API_Key, Secret_Key);
    public   String getAccess_Token(){

        // 调用接口
        JSONObject res = client.asr("https://media-audio1.baydn.com/us%2Fa%2Fab%2Fabc_pub_audio%2Fc64cc0178a063124442b98e8006948d4.57c50c7dc80b91e6e61df22629a9d25b.mp3.mp3", "mp3", 16000, null);
        System.out.println(res.toString(2));

return "fsd";





       // return gson.toJson(gson.fromJson(result,String.class));
    }

    public static void main(String[] args) {
        BaiduAi baiduAi = new BaiduAi();
        System.out.println(baiduAi.getAccess_Token());
    }
}
